
<?php
$smarty->configLoad($lang . '/banlist.module.php');
$language = parse_ini_file($lang . '/breadcrumb.module.php', true);
$breadcrumb = $language['banlist'];
$value = '';
$sql = 'SELECT * FROM '.DB_CMS.'.module_banlist';
$dbh = $connection->prepare($sql);
$dbh->execute();
$user = new user;
foreach($dbh->fetchAll(PDO::FETCH_ASSOC) as $row) {
    $row['username'] = $user->getName($row['userID']); 
    $value[] = $row;
}
if(empty($_GET['action'])) {
    $_GET['action'] = '';
}
if($_GET['action'] == 'unban') {
	$sql = 'DELETE FROM '.DB_CMS.'.module_banlist WHERE id = :id';
	$dbh = $connection->prepare($sql);
	$dbh->bindValue(':id', $_GET['id']);
	$dbh->execute();
	
	$sql = 'UPDATE '.DB_LOGIN.'.account_data SET activated = 1 WHERE id = :userID';
	$dbh = $connection->prepare($sql);
	$dbh->bindValue(':userID', $_GET['userID']);
	$dbh->execute();
    $main->jqmodal('banlist');
		echo '<meta http-equiv="refresh" content="5; URL=index.php?mod=banlist">';

}
$smarty->assign('value', $value);
$template = 'banlist/index.tpl';
?>